<%@ page import="ledrpt.DwrEqpBoard" %>
<%--
    @Description： 设备图形信息列表展示
    @Author： 樊双峰
    @Date： 2018-06-30 1:17
--%>
%{--<style type="text/css">--}%
%{--th, tr, td {--}%
    %{--text-align: center;--}%
%{--}--}%
%{--</style>--}%

<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/EqpBoard/eqpInfo"
          method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="getEqpInfo"/>
            <label >设备区域：</label>&nbsp;
           <g:select name="eqpStateLocationID" from="${eqpStateLocationIDList}" data-toggle="selectpicker" data-live-search="true"
                     data-nextselect="#monEqpid3"
                     data-refurl="${request.getContextPath()}/eqpState/getOptionHTMLByTarget?location={value}&SYS_QUERY_NAME=eqpStateEQPIDList"
                     optionKey="locationId" optionValue="locationDesc" value="${eqpStateLocationID}" noSelection="['':'===请选择===']" />&nbsp;
            <label >设备编号：</label>&nbsp;
           <g:select name="eqpStateEQPID" from="${eqpStateEQPIDList}" data-toggle="selectpicker" data-live-search="true"
                  id="monEqpid3"
                  optionKey="eqpId" optionValue="eqpDesc" value="${eqpStateEQPID}" noSelection="['':'===请选择===']" />&nbsp;

            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;|
            <a class="btn btn-green" data-toggle="dialog" disabled=""
               data-url="${request.getContextPath()}/EqpBoard/addEqp"
               data-title="新增" id="eqp1">设备新增</a>&nbsp;|
            <a href="javascript:void(0)" class="btn btn-blue" onclick="editEqpBoard()" id="eqp2" disabled="">看板维护</a>&nbsp;|
            <a href="javascript:void(0)" class="btn btn-default" onclick="showEqpBoard()" data-icon="home">看板展示</a>
        </div>
    </form>
</div>

<div class="bjui-pageContent tableContent">
    <div style="margin:0px auto; width:100%;">
        <div class="row">
            <div class="col-md-12" id="">
                <g:if test="${getEqpInfo.size() > 0}">
                    <table data-toggle="tablefixed" data-width="100%" data-nowrap="true">
                        <thead>
                            <tr>
                                <th>No.</th>
                                <g:each in="${tableHeadList}" status="i" var="headInstance">
                                    <g:if test="${headInstance!='RN'}">
                                        <g:if test="${headInstance!='ID'}">
                                            <th ><g:message code="${headInstance}" default="${headInstance}"/></th>
                                        </g:if>
                                    </g:if>
                                </g:each>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <g:each in="${getEqpInfo}" status="i" var="eqp">
                                <tr>
                                    <td>${i + 1}</td>
                                    <td>${eqp.EQP_ID}</td>
                                    <td>${eqp.DESCRIPTION}</td>
                                    <td>${eqp.EQP_TYPE}</td>
                                    <td>${eqp.LOCATION}</td>
                                    <td>${eqp.STATE}</td>
                                    <td>${eqp.WIDTH}</td>
                                    <td>${eqp.HEIGHT}</td>
                                    <td>${eqp.containX}</td>
                                    <td>${eqp.X}</td>
                                    <td>${eqp.Y}</td>
                                    <td>
                                        <a class="btn btn-green eqp3" data-toggle="dialog"
                                           data-url="${request.getContextPath()}/EqpBoard/editEqp?id=${eqp.ID}" id="eqp3" disabled=""
                                           data-title="编辑">编辑</a>
                                        <a class="btn btn-red eqp4" data-confirm-msg="确定要删除该行信息吗？"
                                           data-toggle="doajax" data-type="DELETE" id="eqp4" disabled=""
                                           data-callback=function(){$.CurrentNavtab.navtab('refresh')}
                                           href="${request.getContextPath()}/eqpBoard/deleteEqp?id=${eqp.ID}">删除</a>
                                    </td>
                                </tr>
                            </g:each>
                        </tbody>
                    </table>
                </g:if>
                <g:else>
                    <g:render template="../template/emptyPanel"/>
                </g:else>
            </div>
        </div>
    </div>
</div>
<g:render template="../template/pagination"/>
%{--<script  src="${request.getContextPath()}/js/jquery/jquery-1.11.0.min.js"></script>--}%
<script type="text/javascript">
//    $(function () {
//        $.CurrentNavtab.find('#start-date-input,#end-date-input').datetimepicker({
//            format: 'yyyy-mm-dd hh',
//            autoclose: true,
//            todayBtn: true,
//            startView: 1,
//            minView: 1,
//            pickerPosition: "bottom-left",
//            language: 'zh-CN',
//            startDate: '2016-01-01'
//        });
//        $.CurrentNavtab.find('.selectpicker').selectpicker();
//    })

    var editEqpBoard = function(){
        window.open("${request.getContextPath()}/EqpBoard/eqpBoard");
    }

    var showEqpBoard = function(){
        window.open("${request.getContextPath()}/EqpBoard/showEqpBoard");
    }

    $(function(){
        <g:if test="${user == 'ADMIN'||user == 'BHADMIN'||user == 'RENSHIYU'||user == 'CUIZHICHAO'||user == 'WEIQIPENG'}">
        $("#eqp1").attr("disabled",false)
        $("#eqp2").attr("disabled",false)
        $(".eqp3").attr("disabled",false)
        $(".eqp4").attr("disabled",false)
        </g:if>
        %{--<g:else>--}%
        %{--$("#eqp1").attr("disabled",false)--}%
        %{--$("#eqp2").attr("disabled",false)--}%
        %{--</g:else>--}%
    });
</script>